#include <bits/stdc++.h>
using namespace std;
int n,m,a;
struct node{
    int need;
    int idx;
}tmp;
int main(void){
    queue<node> q;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d",&a);
        q.push(node{a,i});
    }
    while(!q.empty()){
        tmp=q.front();
        q.pop();
        if(q.empty()){
            printf("%d\n",tmp.idx);
            return 0;
        }
        if(tmp.need<=0){
            continue;
        }
        q.push(node{tmp.need-m,tmp.idx});
    }
    return 0;
}